From 4ab922b1a7e6e19c260799f56912bcedf51fa725 Mon Sep 17 00:00:00 2001 From: "kaf24@scramble.cl.cam.ac.uk" Date: Fri, 7 Nov 2003 15:57:00 +0000 Subject: [PATCH] bitkeeper revision 1.571 (3fabc0ccIidm1y01SeueL9ZtLe3myA) setup.c, xl_vbd.c, memory.c, process.c: Various fixes. One to SCSI code in xenolinux, others to suspend/resume (which is still a bit broken). --- xen/arch/i386/process.c | 2 ++ xen/common/memory.c | 4 +-- .../arch/xeno/drivers/block/xl_vbd.c | 6 ++-- .../arch/xeno/kernel/setup.c | 36 ++++++++++++++++--- 4 files changed, 39 insertions(+), 9 deletions(-) diff --git a/xen/arch/i386/process.c b/xen/arch/i386/process.c index 4dc4b43e03..4f7d16d761 100644 --- a/xen/arch/i386/process.c +++ b/xen/arch/i386/process.c @@ -249,6 +249,8 @@ void switch_to(struct task_struct *prev_p, struct task_struct *next_p) */ if ( (stack_ec->cs & 3) == 0 ) stack_ec->cs = FLAT_RING1_CS; + if ( (stack_ec->ss & 3) == 0 ) + stack_ec->ss = FLAT_RING1_DS; unlazy_fpu(prev_p); diff --git a/xen/common/memory.c b/xen/common/memory.c index 8d33bd9f20..0eb478c6ee 100644 --- a/xen/common/memory.c +++ b/xen/common/memory.c @@ -138,7 +138,7 @@ #include #include -#if 0 +#if 1 #define MEM_LOG(_f, _a...) printk("DOM%d: (file=memory.c, line=%d) " _f "\n", current->domain, __LINE__, ## _a ) #else #define MEM_LOG(_f, _a...) ((void)0) @@ -274,7 +274,6 @@ int map_ldt_shadow_page(unsigned int off) for ( i = 0; i < 512; i++ ) if ( unlikely(!check_descriptor(ldt_page[i*2], ldt_page[i*2+1])) ) goto out; - if ( unlikely(page->flags & PG_need_flush) ) { perfc_incrc(need_flush_tlb_flush); @@ -479,7 +478,6 @@ static int get_l1_table(unsigned long page_nr) if ( unlikely(ret) ) goto fail; } - out: /* Make sure we unmap the right page! */ unmap_domain_mem(p_l1_entry-1); return ret; diff --git a/xenolinux-2.4.22-sparse/arch/xeno/drivers/block/xl_vbd.c b/xenolinux-2.4.22-sparse/arch/xeno/drivers/block/xl_vbd.c index 7a25020b39..7037576d16 100644 --- a/xenolinux-2.4.22-sparse/arch/xeno/drivers/block/xl_vbd.c +++ b/xenolinux-2.4.22-sparse/arch/xeno/drivers/block/xl_vbd.c @@ -33,7 +33,7 @@ struct gendisk *xlvbd_gendisk[XLVBD_MAX_MAJORS] = { NULL }; #define XLIDE_PARTN_SHIFT 6 /* amount to shift minor to get 'real' minor */ #define XLIDE_MAX_MINORS (1 << XLIDE_PARTN_SHIFT) /* minors per ide vbd */ -#define XLSCSI_PARTN_SHIFT 6 /* amount to shift minor to get 'real' minor */ +#define XLSCSI_PARTN_SHIFT 4 /* amount to shift minor to get 'real' minor */ #define XLSCSI_MAX_MINORS (1 << XLSCSI_PARTN_SHIFT) /* minors per scsi vbd */ #define XLVBD_PARTN_SHIFT 6 /* amount to shift minor to get 'real' minor */ @@ -230,11 +230,13 @@ int __init xlvbd_init(xen_disk_info_t *xdi) hence using unit number for now but in old code was 'disk' aka sequence number assigned by xen during probe = barfle? */ ((xl_disk_t *)gd->real_devices)[minor>>gd->minor_shift].capacity = - xdi->disks[i].capacity; + xdi->disks[i].capacity; /* remember that we've done this major */ majors[major] = 1; + } else { + gd = get_gendisk(device); } if(XD_READONLY(xdi->disks[i].info)) diff --git a/xenolinux-2.4.22-sparse/arch/xeno/kernel/setup.c b/xenolinux-2.4.22-sparse/arch/xeno/kernel/setup.c index 2236663120..7cb888f2d5 100644 --- a/xenolinux-2.4.22-sparse/arch/xeno/kernel/setup.c +++ b/xenolinux-2.4.22-sparse/arch/xeno/kernel/setup.c @@ -1086,12 +1086,24 @@ static void stop_task(void *unused) pfn_to_mfn_frame_list[j++] = virt_to_machine(&phys_to_machine_mapping[i]) >> PAGE_SHIFT; + /* + * NB. This is /not/ a full dev_close() as that loses route information! + * Instead we do essentialy the same as dev_close() but without notifying + * various registered subsystems about the NETDEV_DOWN event. + */ rtnl_lock(); for ( i = 0; i < 10; i++ ) { sprintf(name, "eth%d", i); - if ( (dev = __dev_get_by_name(name)) != NULL ) - dev_close(dev); + if ( ((dev = __dev_get_by_name(name)) != NULL) && + (dev->flags & IFF_UP) ) + { + dev_deactivate(dev); + clear_bit(__LINK_STATE_START, &dev->state); + if ( dev->stop != NULL ) + dev->stop(dev); + dev->flags &= ~IFF_UP; + } } rtnl_unlock(); @@ -1116,12 +1128,28 @@ static void stop_task(void *unused) blkdev_resume(); + /* + * We now do the opposite of the network suspend code. Basically it's + * dev_open() but without notifying anyone about NETDEV_UP. + */ rtnl_lock(); for ( i = 0; i < 10; i++ ) { sprintf(name, "eth%d", i); - if ( (dev = __dev_get_by_name(name)) != NULL ) - dev_open(dev); + if ( ((dev = __dev_get_by_name(name)) != NULL) && + !(dev->flags & IFF_UP) ) + { + set_bit(__LINK_STATE_START, &dev->state); + if ( (dev->open == NULL) || (dev->open(dev) == 0) ) + { + dev->flags |= IFF_UP; + dev_activate(dev); + } + else + { + clear_bit(__LINK_STATE_START, &dev->state); + } + } } rtnl_unlock(); -- 2.30.2